package com.pointi.emoTools;

import java.io.File;
import java.util.Arrays;

public class emoFileInfo
{
	// ____________________________________________________________________________________________________
	// FileInfo | File, FileList, FilePath

	public String [] _File ;
	public String [] _FileList ;
	public String _FilePath ;
	
	public emoFileInfo(String [] inFile, String [] inFileList, String inFilePath)
	{
		_File = inFile ;
		_FileList = inFileList ;
		_FilePath = inFilePath ;
	}
	
	public String getFile (int mIndex)
	{
		return _FilePath + "\\" + _File[mIndex] ;
	}

	public String getFileList (int mIndex)
	{
		return _FilePath + "_XML\\" + _FileList[mIndex] ;
	}
	
	// ____________________________________________________________________________________________________
	// 
	
	public static emoFileInfo fnGetFileArray(String s_path) 
	{
		String samplePath = s_path ;

		// Access Directory
		File dir = new File(samplePath + "\\") ;		
		File [] _File = dir.listFiles() ;
		
		dir = new File(samplePath + "_XML\\") ;		
		File [] _FileList = dir.listFiles() ;		
		
		// Read File (wav)
		String [] _FileName = new String[_File.length] ;
		for (int i=0 ; i<_File.length ; i++) { _FileName[i] = _File[i].getName() ; }
		Arrays.sort(_FileName, String.CASE_INSENSITIVE_ORDER) ;
		
		// Read FileList (xml)
		String [] _FileListName = new String[_FileList.length] ;
		for (int i=0 ; i<_FileList.length ; i++) { _FileListName[i] = _FileList[i].getName() ; }
		Arrays.sort(_FileListName, String.CASE_INSENSITIVE_ORDER) ;
		
		String _FilePath = samplePath ;
		emoFileInfo _FileInfo = new emoFileInfo(_FileName, _FileListName, _FilePath) ;
		return _FileInfo ;
	}
}
